<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="/resource/UserPwoer.tld" prefix="p"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	pageContext.setAttribute("fnId", request.getAttribute("fnId"));
	pageContext.setAttribute("userPwoer", request.getSession().getAttribute("userPwoer"));
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="../images/favicon.ico">
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
<style>
	 
</style>


</head>
<body class="gray-bg">
	<nav class="huiNav">
		<i class="fa fa-home"></i> 首页 <span>&gt;</span>开班信息管理<span>&gt;</span>学生管理
		<a class="btn btn-info  btn-sm pull-right"
			href="javascript:location.replace(location.href);" title="刷新"><i
			class="fa fa-refresh"></i></a>
	</nav>

	<div class="ibox-content">
		<!-- 搜索框部分start -->
		<p:btn value="serch">
			<form class="form-inline" id="serchform">
				
				<div class="form-group mr-20 ">
					<label for="exampleInputName2">学生学号</label>
					<input class="form-control" name="stuNo" id="stuNo" type="text" >
				</div>
				<div class="form-group mr-20">
					<label for="exampleInputName2">学生姓名</label> 
					<input class="form-control" name="stuName" id="stuName" type="text">
				</div>
				
				<label for="exampleInputName2">班级</label> 
				<div class="form-group mr-20">
					<div style="width: 160px;">
						<select name="stuClass" id="stuClass" class="form-control autoFull select2"
							data-url="${path}/admin/tabClass/showAllClass"
							data-filed="claName" data-value="claId"
							>
							<option value="">--请选择所在班级--</option>
						</select>
					</div>
				</div>
				
				<label for="exampleInputName2">缴费类型</label>
				<div class="form-group mr-20">
					<div style="width: 160px;">
						<select name="stuMode" id="stuMode" class="form-control autoFull select2"
							data-url="${path}/admin/studentinfo/showAllPay"
							data-filed="name" data-value="name"
							>
							<option value="">--请选择缴费方式--</option>
						</select>
					</div>
				</div>
				<br/><br/>
				<div class="form-group mr-20">
					<label for="exampleInputName2">入学时间</label>
					<input name="beginTime" id="beginTime" type="text" class="form-control datetimepicker">—
					<input name="endTime" id="endTime" type="text" class="form-control datetimepicker">
				</div>
				
				<button onclick="myGrid.serchData()" type="button" class="btn btn-info btn-sm"> <i class="fa fa-search "></i> 搜索 </button>
				<button type="button"  onclick="MForm.reset('#serchform')" class="btn btn-info btn-sm"> <i class="fa fa-refresh "></i> 重置 </button>

			</form>
		</p:btn>
		<!-- 搜索框部分en -->
		<div class="option-bar">
			<p:btn value="dels">
				<button onclick="myGrid.delItems('stuId')" type="button" class="btn btn-danger btn-sm">
					<i class="fa fa-trash"></i>批量删除
				</button>
			</p:btn>
			<p:btn value="add">
				<button onclick="openAdd()" type="button" class="btn btn-success btn-sm">
					<i class="fa fa-plus"></i> 新增
				</button>
			</p:btn>
			<p:btn value="import">
				<button onclick="openImport()" type="button" class="btn btn-warning btn-sm"><i class="fa fa-cloud-upload" ></i> 导入</button>
			</p:btn>
			<p:btn value="export">
				<button onclick="exportExcel()" type="button" class="btn btn-info btn-sm"><i class="fa fa-cloud-download" ></i> 导出</button>
			</p:btn>
		</div>
		<table id="mgrid" 
		>
			<thead>
				<tr>
					<th data-checkbox="true"  ></th>
					<th data-formatter="MGrid.indexfn" data-align="center"
						data-width="30px">序号</th>
					<th data-field="stuNo" >学号</th>
					<th data-field="stuName">姓名</th>
					<th data-field="stuSchool">来自院校</th>
					<th data-field="stuIfschool">是否院校毕业</th>
					<th data-field="claName">所在班级</th>
					<th data-field="couName">课程</th>
					<th data-field="stuTuition">学费标准</th>
					<th data-field="stuMode">缴费方式</th>
					<th data-field="stuPmoney">优惠金额</th>
					<th data-field="stuCause">优惠原因</th>
					<th data-field="payable">应交学费</th>
					<th data-field="stuDate" data-formatter="MGrid.getTimeDD">入学时间</th>
					<th data-field="stuStatus">状态</th>
					<th data-field="tcName">班主任</th>
					<th data-field="stuRemark" >备注</th>
					<th data-align="center" data-field="stuId" data-formatter="buidOperate">操作</th>
				</tr>
			</thead>
		</table>
	</div>
	<script type="text/javascript">
		var myGrid;
		$(function() {
			//带搜索的下拉框
			$(".select2").select2({'width':'100%'});
			$(".select2").trigger("blur");
			//初始化下拉框
			MTools.autoFullSelect();
			//初始化日期控件
			MTools.ininDatetimepicker({
				listenBlur : true
			});
			
			//有删除权限
			var delUrl="";
			<p:btn value="dels">
			delUrl="${path}/admin/studentinfo/del";
			</p:btn>
			
			myGrid = MGrid.initGrid({
				url : "${path}/admin/studentinfo/showList",
				delUrl:delUrl
				
			});
		});
		function buidOperate(value, row, index) {
			var html = '';
			<p:btn value="edit">
			html += '<button class="btn btn-default btn-sm mr-5" onClick="openEdit('
					+ value
					+ ')"  title="编辑"><i class="fa fa-edit"></i></buttoun>'
			</p:btn>
			<p:btn value="del">
			html += '<button class="btn btn-default btn-sm" onClick="myGrid.delItem('
					+ value
					+ ')" title="删除"><i class="fa fa-lg fa-trash-o"></i></buttoun>';
			</p:btn>
			html += ''
			return html;
		}
		//打开添加界面
		<p:btn value="add">
		function openAdd() {
			layer.open({
				type : 2,
				title : "添加学生",
				area : [ MUI.SIZE_L, '560px' ],
				maxmin : true,
				content : [ '${path}/admin/studentinfo/editForm' ]
			});
		}
		</p:btn>
		
		//打开编辑界面
		<p:btn value="edit">
		function openEdit(id) {
			layer.open({
				type : 2,
				title : "编辑学生",
				area : [ MUI.SIZE_L, '560px' ],
				maxmin : true,
				content : [ '${path}/admin/studentinfo/editForm?id=' + id ]
			});
		}
		</p:btn>
		
		<p:btn value="import">
		function openImport(){
		    //弹出修改框
		    layer.open({
		        type : 2,
		        title : "批量导入",
		        area : [ MUI.SIZE_L, '480px' ],
		        maxmin : true,
		        content : [ '${path}/admin/redirect/studentImportDialog']
		    });
		}
		</p:btn>
		
		
		<p:btn value="export">
		function exportExcel(){
			var sNo = $("#sNo").val();
			var sName = $("#sName").val();
			
			window.location.href="${path}/admin/studentinfo/exportExcel?sNo="+stuNo
					+"&sName="+stuName;
		}
		</p:btn>
	</script>
</body>
</html>
